# -*- coding: utf-8 -*-

from common.log import logger
from common.mymako import render_mako_context, render_json
from account.decorators import login_exempt
from blueking.component.shortcuts import get_client_by_request


def home(request):
    """
    Home Page
    """
    client = get_client_by_request(request)
    kwargs = {
        #"bk_app_code": "esb_test",
        #"bk_app_secret": "xxx",
        #"bk_token": "xxx",
        "receiver": "18122657879@189.cn",
        "sender": "18122657879@163.com",
        "title": "BK SendMail Test",
        "content": "<html>发送邮件测试</html>",
    }

    resp = client.cmsi.send_mail(**kwargs)
    if resp.get('result'):
        result = {'result': u'done'}
    return render_json(result)

